import { Pipe, PipeTransform } from '@angular/core';
import {DomSanitizer} from '@angular/platform-browser';

@Pipe({
  name: 'html'
})
/**
 * @author csw
 * @description:解析带样式的后台数据渲染-html管道机制
 * @date 2021-01-27 17:17:23
 */
export class HtmlPipe implements PipeTransform {
  constructor(private sanitizer:DomSanitizer) {
  }
  transform(style:any): any {
    return (this.sanitizer.bypassSecurityTrustHtml(style) || this.sanitizer.bypassSecurityTrustStyle(style));
  }

}
